"""
close()关闭文件流
为了确保打开的文件对象正常关闭，一般结合异常机制的 finally 或者with 关键字实现无论何种情况都能关闭打开的文件对象。
"""
try:
    f = open(r"code_IO_file\03_CLOSE_FILE_STREAM.txt", "w")
    f.write("Hello World")
except BaseException as e:
    print(e)
finally:
    f.close()
